﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Account/Site.master" AutoEventWireup="true" CodeFile="ctTinTuc.aspx.cs" Inherits="Administrator_ctTinTuc" %>

<%@ Register assembly="FredCK.FCKeditorV2" namespace="FredCK.FCKeditorV2" tagprefix="FCKeditorV2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <asp:SiteMapPath ID="SiteMapPath1" runat="server" Font-Names="Verdana" 
        Font-Size="0.8em" PathSeparator=" : " style="font-size: small">
        <CurrentNodeStyle ForeColor="#333333" />
        <NodeStyle Font-Bold="True" ForeColor="#284E98" />
        <PathSeparatorStyle Font-Bold="True" ForeColor="#507CD1" />
        <RootNodeStyle Font-Bold="True" ForeColor="#507CD1" />
    </asp:SiteMapPath>
    <br />
    <asp:Label ID="Label1" runat="server" 
        style="font-size: x-large; font-weight: 700" Text="Chi tiết tin tức"></asp:Label>
    <br />
    <br />
    <asp:FormView ID="FormView1" runat="server" DataKeyNames="ID" 
                DataSourceID="SqlDataSource2" EnableModelValidation="True" 
                onitemupdated="FormView1_ItemUpdated" Width="100%" 
                oniteminserted="FormView1_ItemInserted" CellPadding="4" 
        ForeColor="#333333" oniteminserting="FormView1_ItemInserting">
        <EditItemTemplate>
                    ID:
                    <asp:Label ID="IDLabel1" runat="server" Text='<%# Eval("ID") %>' />
                    <br />
                   
                    <%--Loại Tin:
                    <asp:DropDownList ID="ddlLoaiTin" runat="server" AutoPostBack="True" 
                        DataSourceID="SqlDataSource3" DataTextField="TieuDe" DataValueField="ID" 
                        SelectedValue='<%# Bind("LoaiTin") %>' Width="300px">
                    </asp:DropDownList>--%>
                   <%-- <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                        SelectCommand="SELECT * FROM [LoaiTin]">
                    </asp:SqlDataSource>--%>
            <br />
                    TieuDe:
                    <asp:TextBox ID="TieuDeTextBox" runat="server" Text='<%# Bind("TieuDe") %>' 
                        Width="90%" />
            <br />
                    Hình ảnh :
                    <asp:FileUpload ID="UpdateAnh" runat="server" />
            <br />
                    GioiThieu:
                    <asp:TextBox ID="GioiThieuTextBox" runat="server" 
                        Text='<%# Bind("GioiThieu") %>' TextMode="MultiLine" Width="90%" />
            <asp:HiddenField ID="HiddenField1" runat="server" 
                        Value='<%# Bind("HinhAnh") %>' />
            <asp:HiddenField ID="HiddenField2" runat="server" 
                        Value='<%# Bind("NguoiDang") %>' />
            <asp:HiddenField ID="HiddenField3" runat="server" 
                        Value='<%# Bind("NgayDang") %>' />
            <br />
                    NoiDung:
                    <br />
            <FCKeditorV2:FCKeditor ID="FCKeditor1" runat="server" BasePath="~/fckeditor/" 
                        Height="600px" Value='<%# Bind("NoiDung") %>' Width="100%">
            </FCKeditorV2:FCKeditor>
            <br />
            <br />
            <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                        CommandName="Update" Text="Update" />
                    &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                        CausesValidation="False" CommandName="Cancel" Text="Cancel" />
        </EditItemTemplate>
        <EditRowStyle BackColor="#999999" />
        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <InsertItemTemplate>
                    ID:
                    <asp:Label ID="IDLabel2" runat="server" Text='<%# Eval("ID") %>' />
                  
                    <%--<asp:DropDownList ID="ddlLoaiTin" runat="server" 
                        DataSourceID="SqlDataSource3" DataTextField="TieuDe" DataValueField="ID" 
                        SelectedValue='<%# Bind("LoaiTin") %>' Width="300px" AutoPostBack="True">
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:tantinhn_dietmoitmConnectionString %>" 
                        SelectCommand="SELECT * FROM [LoaiTin] WHERE ([TheLoai] = @TheLoai)">
                        <SelectParameters>
                            <asp:QueryStringParameter Name="TheLoai" QueryStringField="theloaiid" 
                                Type="Int32" />
                        </SelectParameters>
                    </asp:SqlDataSource>--%>
            <br />
                    TieuDe:&nbsp;&nbsp;&nbsp;&nbsp;
                    <asp:TextBox ID="TieuDeTextBox0" runat="server" Text='<%# Bind("TieuDe") %>' 
                        Width="90%" />
            <br />
                    Hình ảnh :
                    <asp:FileUpload ID="InsertAnh" runat="server" />
            <br />
                    GioiThieu:
                    <asp:TextBox ID="GioiThieuTextBox0" runat="server" 
                        Text='<%# Bind("GioiThieu") %>' TextMode="MultiLine" Width="90%" />
                    NoiDung:
                    <br />
            <FCKeditorV2:FCKeditor ID="FCKeditor2" runat="server" BasePath="~/fckeditor/" 
                        Height="600px" Value='<%# Bind("NoiDung") %>' Width="100%">
            </FCKeditorV2:FCKeditor>
            <br />
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                        ControlToValidate="TieuDeTextBox0" Display="None" 
                        ErrorMessage="Tiêu đề không được rỗng"></asp:RequiredFieldValidator>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                        ControlToValidate="GioiThieuTextBox0" 
                        ErrorMessage="Giới thiệu không được rỗng" Display="None"></asp:RequiredFieldValidator>
                    <asp:ValidationSummary ID="ValidationSummary1" runat="server" />
            <br />
            <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                        CommandName="Insert" Text="Insert" />
                    &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                        CausesValidation="False" CommandName="Cancel" Text="Cancel" 
                        onclick="InsertCancelButton_Click" />
        </InsertItemTemplate>
        <ItemTemplate>
                    ID:
                    <asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />
            <br />
                    TieuDe:
                    <asp:Label ID="TieuDeLabel" runat="server" 
                Text='<%# Bind("TieuDe") %>' />
            <br />
                    HinhAnh:
                    <asp:Image ID="Image1" runat="server" Height="212px" Width="200px" 
                        ImageUrl='<%# Eval("HinhAnh") %>' />
            <br />
                    GioiThieu:
                    <asp:Label ID="GioiThieuLabel" runat="server" 
                Text='<%# Bind("GioiThieu") %>' />
            <br />
                    NoiDung:
                    <asp:Label ID="NoiDungLabel" runat="server" 
                Text='<%# Bind("NoiDung") %>' />
            <br />
                    NgayDang:
                    <asp:Label ID="NgayDangLabel" runat="server" 
                Text='<%# Bind("NgayDang") %>' />
            <br />
                    NguoiDang:
                    <asp:Label ID="NguoiDangLabel" runat="server" 
                Text='<%# Bind("NguoiDang") %>' />
            <br />
            <br />
            <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" 
                        CommandName="Edit" Text="Edit" />
&nbsp;<asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" 
                        CommandName="Delete" Text="Delete" />
                    &nbsp;<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" 
                        CommandName="New" Text="New" />
        </ItemTemplate>
        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
    </asp:FormView>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                ConnectionString="<%$ ConnectionStrings:ConnectServer %>" 
                DeleteCommand="DELETE FROM [TinTuc] WHERE [ID] = @ID" 
                InsertCommand="INSERT INTO TinTuc(TieuDe, NoiDung, NgayDang, NguoiDang, HinhAnh, GioiThieu, LoaiTin) VALUES (@TieuDe, @NoiDung, GETDATE(), 'Manager', @HinhAnh, @GioiThieu,@LoaiTin)" 
                SelectCommand="SELECT * FROM [TinTuc] WHERE ([ID] = @ID)" 
                
                
        
        
        
        
        UpdateCommand="UPDATE TinTuc SET TieuDe = @TieuDe, NoiDung = @NoiDung, NgayDang = @NgayDang, NguoiDang = @NguoiDang, HinhAnh = @HinhAnh, GioiThieu = @GioiThieu, LoaiTin =@LoaiTin WHERE (ID = @ID)">
        <DeleteParameters>
            <asp:Parameter Name="ID" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="TieuDe" Type="String" />
            <asp:Parameter Name="NoiDung" Type="String" />
            <asp:Parameter Name="HinhAnh" Type="String" />
            <asp:Parameter Name="GioiThieu" Type="String" />
            <asp:Parameter Name="LoaiTin" />
        </InsertParameters>
        <SelectParameters>
            <asp:QueryStringParameter Name="ID" QueryStringField="ID" Type="Int32" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="TieuDe" Type="String" />
            <asp:Parameter Name="NoiDung" Type="String" />
            <asp:Parameter Name="NgayDang" Type="DateTime" />
            <asp:Parameter Name="NguoiDang" Type="String" />
            <asp:Parameter Name="HinhAnh" Type="String" />
            <asp:Parameter Name="GioiThieu" Type="String" />
            <asp:Parameter Name="LoaiTin" />
            <asp:Parameter Name="ID" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <asp:LinkButton ID="LinkButton2" runat="server" 
        PostBackUrl="~/Administrator/TinTuc.aspx" CausesValidation="False">Quay về danh sách</asp:LinkButton>
</asp:Content>

